<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 模拟数据
        let did = []
        for (let i = 1; i < 37; i++) {
            did.push('我是第' + i + '个');
        }


        let twoDArray = []; //did 二维数组
        let tempArray = [];//临时存储
        let index = 0;// 限制二维数组内的数组长度
        for (let i = 0; i < did.length; i++) {
            if (index >= 5) {
                index = 0;
                // 限制二维数组内的数组长度
                if (tempArray.length >= 5) {
                    twoDArray.push(tempArray);
                    tempArray = [];
                }
            }
            tempArray.push(did[i]);
            index++;
        }

        if (tempArray.length > 0) {
            twoDArray.push(tempArray);
        }

        console.log(twoDArray);
    </script>
</body>

</html>